home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / jasperNamedCommandSetup.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  29.7 KB  |  1,024 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. global int $reflectionXTurnedOff = false ;
  18. global int $reflectionYTurnedOff = false ;
  19. global int $reflectionZTurnedOff = false ;
  20.  
  21. global proc deletePopupMenu()
  22. {
  23.     if( `popupMenu -q -exists tempMM` ) {
  24.         deleteUI tempMM; 
  25.     }
  26.     
  27.     if( `popupMenu -q -exists tempMM2` ) {
  28.         deleteUI tempMM2; 
  29.     }
  30. }
  31.  
  32. proc string currentToolClass()
  33. {
  34.     string  $currentContext = `currentCtx`;
  35.     return `contextInfo -c $currentContext`;
  36. }
  37.  
  38. proc string jasperCommand()
  39. {
  40.     string  $currentTool    = currentToolClass();
  41.  
  42.     string  $jasperCmd = "";
  43.  
  44.     if ( $currentTool == "putty" ) {
  45.         $jasperCmd = "puttyCtx";
  46.     }
  47.     else if ( $currentTool == "selectPaint" ) {
  48.         $jasperCmd = "selectPaintCtx";
  49.     }
  50.     else if ( $currentTool == "userPaint" ) {
  51.         $jasperCmd = "userPaintCtx";
  52.     }
  53.     else if ( $currentTool == "attrPaint" 
  54.               || attrPaintInstCheckTool($currentTool) ) {
  55.         $jasperCmd = "attrPaintCtx";
  56.     }
  57.     else if ( $currentTool == "wtPaint" ) {
  58.         $jasperCmd = "wtPaintCtx";
  59.     }
  60.     else if ( $currentTool == "setEditPaint" ) {
  61.         $jasperCmd = "setEditPaintCtx";
  62.     }
  63.     else if ( $currentTool == "paintColor" ) {
  64.         $jasperCmd = "paintColorCtx";
  65.     }
  66.  
  67.     return $jasperCmd;
  68. }
  69.  
  70. proc int isAdynPaintPanel()
  71. {
  72.     string $currentPanel = `getPanel -withFocus`;
  73.     return (`scriptedPanel -ex $currentPanel` &&
  74.     `scriptedPanel -q -type $currentPanel` == "dynPaintScriptedPanelType");
  75. }
  76.  
  77. proc int isDynWireContext()
  78. {
  79.     string $cc = `currentCtx`;
  80.     string $ct = `contextInfo -t $cc`;
  81.  
  82.     return ($ct == "Paint Effects");
  83. }
  84.  
  85. proc int isCommonPaintCtx()
  86. {
  87.     string    $tc = currentToolClass();
  88.  
  89.     return $tc == "putty" || $tc == "selectPaint"
  90.         || $tc == "userPaint" || $tc == "wtPaint"
  91.         || $tc == "setEditPaint" || $tc == "attrPaint" 
  92.         || $tc == "paintColor"
  93.         || attrPaintInstCheckTool($tc);
  94. }
  95.  
  96. proc int isSurfacePaintCtx()
  97. {
  98.     string    $tc = currentToolClass();
  99.  
  100.     return $tc == "putty" 
  101.         || $tc == "userPaint" || $tc == "wtPaint" || $tc == "attrPaint" 
  102.         || attrPaintInstCheckTool($tc);
  103. }
  104.  
  105. proc int isPuttyCtx()
  106. {
  107.     string    $tc = currentToolClass();
  108.  
  109.     return $tc == "putty";
  110. }
  111.  
  112. proc int isValuePaintCtx()
  113. {
  114.     string    $tc = currentToolClass();
  115.  
  116.     return $tc == "userPaint" || $tc == "wtPaint" || $tc == "attrPaint"
  117.         ||  attrPaintInstCheckTool($tc);
  118. }
  119.  
  120. proc int isWtPaintCtx()
  121. {
  122.     string    $tc = currentToolClass();
  123.  
  124.     return $tc == "wtPaint";
  125. }
  126.  
  127.  
  128. proc int isSetEditPaintCtx() 
  129. {
  130.     string    $tc = currentToolClass();
  131.  
  132.     return $tc == "setEditPaint";
  133. }
  134.  
  135. proc int isPaintColorCtx() 
  136. {
  137.     string  $tc = currentToolClass();
  138.     return $tc == "paintColor";
  139. }
  140.  
  141. global proc increaseBrushRadius( )
  142. {
  143.     string     $jasperCmd = jasperCommand();
  144.  
  145.     if ( $jasperCmd != "" ) {
  146.         // we have to make sure that we are not increasing 
  147.         // the radius beyond the uppper limit
  148.         float $radius  = eval( $jasperCmd + " -q -radius `currentCtx`" );
  149.         $radius = 1.1 * $radius;
  150.         if ( $radius > 50.0 ) { $radius = 50.0; }
  151.         $cmd =  $jasperCmd + " -e -radius " + $radius + " `currentCtx`";
  152.         eval( $cmd );
  153.     }
  154. }
  155.  
  156. global proc decreaseBrushRadius( )
  157. {
  158.     string     $jasperCmd = jasperCommand();
  159.  
  160.     if ( $jasperCmd != "" ) {
  161.         // we have to make sure that we are not decreasing 
  162.         // the radius beyond the lower limit
  163.         float $radius      = eval( $jasperCmd + " -q -radius `currentCtx`" );
  164.         float $lowerRadius = eval( $jasperCmd + " -q -lowerradius `currentCtx`" ); 
  165.  
  166.         $radius = 0.9 * $radius;
  167.         if ( $radius < $lowerRadius ) { $radius = $lowerRadius; }
  168.         $cmd =  $jasperCmd + " -e -radius " + $radius + " `currentCtx`";
  169.         eval( $cmd );
  170.     }
  171. }
  172.  
  173. global proc toggleReflection() 
  174. {
  175.     source "artisanNamedCommandSetup.mel" ;
  176.  
  177.     global int $reflectionXTurnedOff ;
  178.     global int $reflectionYTurnedOff ;
  179.     global int $reflectionZTurnedOff ;
  180.     
  181.     if ( isArtisanCtx() ) {
  182.         string $artCmd = artisanCommand(); 
  183.         if ( $artCmd != "" ) {
  184.             string $curContext = `currentCtx` ;
  185.             
  186.             // is any reflection turned on ?
  187.             // if Yes, turn off what ever is turned on and make a note of it.
  188.             // if No, turn on what ever was last turned off by using this command
  189.             string $cmd0 = $artCmd + " -q -reflectX `currentCtx`";
  190.             string $cmd1 = $artCmd + " -q -reflectY `currentCtx`";
  191.             string $cmd2 = $artCmd + " -q -reflectZ `currentCtx`";
  192.  
  193.             int $reflectX = eval($cmd0) ;
  194.             int $reflectY = eval($cmd1) ;
  195.             int $reflectZ = eval($cmd2) ;
  196.  
  197.             if ( $reflectX == true || $reflectY == true || $reflectZ == true) {
  198.                 if ( $reflectX ) { 
  199.                     $cmd0 = $artCmd + " -e -reflectX false `currentCtx`";
  200.                     eval($cmd0) ;
  201.                     $reflectionXTurnedOff = true ;
  202.                 }
  203.                 if ( $reflectY ) { 
  204.                     $cmd0 = $artCmd + " -e -reflectY false `currentCtx`";
  205.                     eval($cmd0) ;
  206.                     $reflectionYTurnedOff = true ;
  207.                 }
  208.                 if ( $reflectZ ) { 
  209.                     $cmd0 = $artCmd + " -e -reflectZ false `currentCtx`";
  210.                     eval($cmd0) ;
  211.                     $reflectionZTurnedOff = true ;
  212.                 }
  213.                 
  214.                 // Update the UI in artisan tools.
  215.                 if ( `checkBoxGrp -exists artReflectionChBox` ) {
  216.                     checkBoxGrp -e -v1 0 -v2 0 -v3 0 artReflectionChBox;
  217.                 }
  218.                 // Update the UI in 3d Paint tool.
  219.                 if ( `checkBoxGrp -exists art3dReflectionChBox` ) {
  220.                     checkBoxGrp -e -v1 0 -v2 0 -v3 0 art3dReflectionChBox;
  221.                 }
  222.             } else {
  223.                 if( $reflectionXTurnedOff ) {
  224.                     $cmd0 = $artCmd + " -e -reflectX true `currentCtx`";
  225.                     eval($cmd0) ;
  226.                 }
  227.                 if( $reflectionYTurnedOff ) {
  228.                     $cmd0 = $artCmd + " -e -reflectY true `currentCtx`";
  229.                     eval($cmd0) ;
  230.                 }
  231.                 if( $reflectionZTurnedOff ) {
  232.                     $cmd0 = $artCmd + " -e -reflectZ true `currentCtx`";
  233.                     eval($cmd0) ;
  234.                 }
  235.                 
  236.                 // Update the UI in artisan tools.
  237.                 if ( `checkBoxGrp -exists artReflectionChBox` ) {
  238.                     checkBoxGrp -e -va3 $reflectionXTurnedOff $reflectionYTurnedOff $reflectionZTurnedOff artReflectionChBox;
  239.                 }
  240.                 // Update the UI in 3d Paint tool.
  241.                 if ( `checkBoxGrp -exists art3dReflectionChBox` ) {
  242.                     checkBoxGrp -e -va3 $reflectionXTurnedOff $reflectionYTurnedOff $reflectionZTurnedOff art3dReflectionChBox;
  243.                 }
  244.  
  245.                 $reflectionXTurnedOff = false ;
  246.                 $reflectionYTurnedOff = false ;
  247.                 $reflectionZTurnedOff = false ;
  248.             }
  249.         }
  250.     } else {
  251.  
  252.         string     $jasperCmd = jasperCommand();
  253.  
  254.         if ( $jasperCmd != "" ) {
  255.  
  256.             string $cmd = ($jasperCmd + " -q -reflectpaint `currentCtx`");
  257.  
  258.             if ( eval($cmd) ) {
  259.                 eval( $jasperCmd + " -e -reflectpaint false `currentCtx`" );
  260.             }
  261.             else {
  262.                 eval( $jasperCmd + " -e -reflectpaint true `currentCtx`" );
  263.             }
  264.         }
  265.     }
  266. }
  267.  
  268. global proc toggleInvertReflectVector() 
  269. {
  270.     string     $jasperCmd = jasperCommand();
  271.  
  272.     if ( $jasperCmd != "" ) {
  273.  
  274.         string $cmd = ($jasperCmd + " -q -invertrefvector `currentCtx`");
  275.  
  276.         if ( eval($cmd) ) {
  277.             eval( $jasperCmd + " -e -invertrefvector false `currentCtx`" );
  278.         }
  279.         else {
  280.             eval( $jasperCmd + " -e -invertrefvector true `currentCtx`" );
  281.         }
  282.     }
  283. }
  284.  
  285. global proc toggleActiveLines( ) 
  286. {
  287.     string     $jasperCmd = jasperCommand();
  288.  
  289.     if ( $jasperCmd != "" ) {
  290.  
  291.         string $cmd = ($jasperCmd + " -q -showactive `currentCtx`");
  292.  
  293.         if ( eval($cmd) ) {
  294.             eval( $jasperCmd + " -e -showactive false `currentCtx`" );
  295.         }
  296.         else {
  297.             eval( $jasperCmd + " -e -showactive true `currentCtx`" );
  298.         }
  299.     }
  300. }
  301.  
  302.  
  303. global proc toggleShowPreview( ) 
  304. {
  305.     string     $jasperCmd = jasperCommand();
  306.  
  307.     if ( $jasperCmd != "" ) {
  308.  
  309.         string $cmd = ($jasperCmd + " -q -feedback `currentCtx`");
  310.  
  311.         if ( eval($cmd) ) {
  312.             eval( $jasperCmd + " -e -feedback false `currentCtx`" );
  313.         }
  314.         else {
  315.             eval( $jasperCmd + " -e -feedback true `currentCtx`" );
  316.         }
  317.     }
  318. }
  319.  
  320.  
  321. global proc toggleMaskingCVs() 
  322. {
  323.     if ( isSurfacePaintCtx() ) {
  324.  
  325.         string $cmd = ("surfacePaintCtx" + " -q -maskcv `currentCtx`");
  326.  
  327.         if ( eval($cmd) == "off" ) {
  328.             eval( "surfacePaintCtx" + " -e -maskcv \"select\" `currentCtx`" );
  329.         }
  330.         else {
  331.             eval( "surfacePaintCtx" + " -e -maskcv \"off\" `currentCtx`" );
  332.         }
  333.     }
  334. }
  335.  
  336.  
  337. global proc changeCommonEdgeDisplay()
  338. {
  339.     string     $jasperCmd = jasperCommand();
  340.  
  341.     if ( $jasperCmd != "" ) {
  342.  
  343.         string $cmd = ($jasperCmd + " -q -commedgedisplay `currentCtx`");
  344.         string $type = `eval $cmd`;
  345.         if ( $type == "off" ) {
  346.             eval( $jasperCmd + " -e -commedgedisplay \"one\" `currentCtx`" );
  347.         } else if ( $type == "one" ) {
  348.             eval( $jasperCmd + " -e -commedgedisplay \"all\" `currentCtx`" );
  349.         } else if ( $type == "all" ) {
  350.             eval( $jasperCmd + " -e -commedgedisplay \"off\" `currentCtx`" );
  351.         }
  352.     }
  353. }
  354.  
  355. global proc toggleCommonCornersDisplay()
  356. {
  357.     string     $jasperCmd = jasperCommand();
  358.  
  359.     if ( $jasperCmd != "" ) 
  360.     {
  361.         string $cmd = ($jasperCmd + " -q -ccd `currentCtx`");
  362.         string $type = `eval $cmd`;
  363.         if ( $type == "off" ) {
  364.             eval( $jasperCmd + " -e -ccd \"all\" `currentCtx`" );
  365.         } else {
  366.             eval( $jasperCmd + " -e -ccd \"off\" `currentCtx`" );
  367.         }
  368.     }
  369.  
  370. }
  371.  
  372. global proc floodSurfaces() 
  373. {
  374.     string     $jasperCmd = jasperCommand();
  375.  
  376.     if ( $jasperCmd != "" ) {
  377.         eval( $jasperCmd + " -e -clear `currentCtx`" );
  378.     }
  379. }
  380.  
  381. global proc jasperBrushReflectMode( string $jasperCmd )
  382. {
  383.     string $cmd = ($jasperCmd + " -q -reflectpaint `currentCtx`");
  384.     int $flag = eval($cmd);
  385.     menuItem -cb $flag -label "Reflection On/Off" MM_ReflectFlag;
  386.  
  387.     $cmd = ($jasperCmd + " -q -invertrefvector `currentCtx`");
  388.     $flag = eval($cmd);
  389.     menuItem -cb $flag -label "Invert Ref. Vector" MM_InvertReflectVector;
  390.  
  391.     menuItem -sm true -label "Reflect Mode";
  392.         radioMenuItemCollection;
  393.         menuItem -rb false -label "U Dir" MM_ReflectMode_U;
  394.         menuItem -rb false -label "V Dir" MM_ReflectMode_V;
  395.         menuItem -rb false -label "Multiple Surf" MM_ReflectMode_Multi;
  396.     setParent -m ..;
  397.  
  398.     $cmd = ($jasperCmd + " -q -reflectpainttype `currentCtx`");
  399.     string $operation = `eval $cmd`;
  400.     if ( $operation == "reflectU" ) {
  401.         menuItem -e -rb true MM_ReflectMode_U;
  402.         menuItem -e -rb false MM_ReflectMode_V;
  403.         menuItem -e -rb false MM_ReflectMode_Multi;
  404.     } 
  405.     else if ( $operation == "reflectV" ) {
  406.         menuItem -e -rb false MM_ReflectMode_U;
  407.         menuItem -e -rb true  MM_ReflectMode_V;
  408.         menuItem -e -rb false MM_ReflectMode_Multi;
  409.     }
  410.     else if ( $operation == "reflectMult" ) {
  411.         menuItem -e -rb false MM_ReflectMode_U;
  412.         menuItem -e -rb false MM_ReflectMode_V;
  413.         menuItem -e -rb true  MM_ReflectMode_Multi;
  414.     } 
  415.  
  416.     menuItem -e -c ("toggleReflection") MM_ReflectFlag;
  417.     menuItem -e -c ("toggleInvertReflectVector") MM_InvertReflectVector;
  418.     menuItem -e -c ($jasperCmd + " -e -reflectpainttype \"reflectU\" `currentCtx`")
  419.         MM_ReflectMode_U;
  420.     menuItem -e -c ($jasperCmd + " -e -reflectpainttype \"reflectV\" `currentCtx`")
  421.         MM_ReflectMode_V;
  422.     menuItem -e -c ($jasperCmd + " -e -reflectpainttype \"reflectMult\" `currentCtx`")
  423.         MM_ReflectMode_Multi;
  424. }
  425.  
  426. global proc puttyReferenceVectorDetails()
  427. {
  428.     menuItem -rp "N" -l "Normal"
  429.         -c ("puttyCtx -e -refvector \"normal\" `currentCtx`");
  430.     menuItem -rp "NW" -l "First Normal"
  431.         -c ("puttyCtx -e -refvector \"firstnormal\" `currentCtx`");
  432.     menuItem -rp "NE" -l "View"
  433.         -c ("puttyCtx -e -refvector \"view\" `currentCtx`");
  434.     
  435.     menuItem -rp "W" -l "U Direction"
  436.         -c ("puttyCtx -e -refvector \"visoparm\" `currentCtx`");
  437.     menuItem -rp "E" -l "V Direction"
  438.         -c ("puttyCtx -e -refvector \"uisoparm\" `currentCtx`");
  439.     
  440.     menuItem -rp "SW" -l "X Axis"
  441.         -c ("puttyCtx -e -refvector \"xaxis\" `currentCtx`");
  442.     menuItem -rp "S" -l "Y Axis"
  443.         -c ("puttyCtx -e -refvector \"yaxis\" `currentCtx`");
  444.     menuItem -rp "SE" -l "Z Axis"
  445.         -c ("puttyCtx -e -refvector \"zaxis\" `currentCtx`");
  446. }
  447.  
  448. global proc puttyReferenceVector()
  449. {
  450.     string     $jasperCmd = jasperCommand();
  451.  
  452.     if ( $jasperCmd != "" ) {
  453.         deletePopupMenu();
  454.  
  455.         if ( $jasperCmd == "puttyCtx" ) {
  456.             popupMenu -mm 1 -b 1 -p viewPanes tempMM2; 
  457.             puttyReferenceVectorDetails();
  458.             setParent -m ..;
  459.         }
  460.     }
  461. }
  462.  
  463. proc jasperAttrPaintBrushMode( string $jasperCmd )
  464. {
  465.    string $currentTool = currentToolClass();
  466.  
  467.    if( $currentTool != "attrPaint" 
  468.        && attrPaintInstCheckTool($currentTool) ) 
  469.    {
  470.        popupMenu -mm 1 -b 1 -p viewPanes tempMM;
  471.            if( !attrPaintInstCustomizeMM() ) {
  472.                menuItem -rp "N" -l "Add"
  473.                    -c ($jasperCmd + " -e -et \"additive\" `currentCtx`");
  474.                menuItem -rp "S" -l "Scale"
  475.                    -c ($jasperCmd + " -e -et \"scale\" `currentCtx`");
  476.                menuItem -rp "W" -l "Smooth"
  477.                    -c ($jasperCmd + " -e -et \"smooth\" `currentCtx`");
  478.                menuItem -rp "E" -l "Replace"
  479.                    -c ($jasperCmd + " -e -et \"absolute\" `currentCtx`");
  480.            }
  481.            jasperBrushReflectMode( $jasperCmd ) ;
  482.        setParent -m ..;
  483.    }
  484.    else {
  485.        popupMenu -mm 1 -b 1 -p viewPanes tempMM;
  486.            menuItem -rp "N" -l "Add"
  487.                -c ($jasperCmd + " -e -et \"additive\" `currentCtx`");
  488.            menuItem -rp "S" -l "Scale"
  489.                -c ($jasperCmd + " -e -et \"scale\" `currentCtx`");
  490.            menuItem -rp "W" -l "Smooth"
  491.                -c ($jasperCmd + " -e -et \"smooth\" `currentCtx`");
  492.            menuItem -rp "E" -l "Replace"
  493.                -c ($jasperCmd + " -e -et \"absolute\" `currentCtx`");
  494.            jasperBrushReflectMode( $jasperCmd ) ;
  495.        setParent -m ..;  
  496.    }
  497. }
  498.  
  499. global proc jasperBrushMode( ) 
  500. {
  501.     string     $jasperCmd = jasperCommand();
  502.  
  503.     // do nothing if in Texture Paint Tool
  504.     if ( $jasperCmd == "paintColorCtx" ) return;
  505.  
  506.     if ( $jasperCmd != "" ) {
  507.         deletePopupMenu();
  508.  
  509.         if ( $jasperCmd == "puttyCtx" ) {
  510.             popupMenu -mm 1 -b 1 -p viewPanes tempMM;
  511.                 menuItem -rp "N" -l "Pull"
  512.                     -c ("puttyCtx -e -mtm " + " \"pull\" `currentCtx`");
  513.                 menuItem -rp "S" -l "Push"
  514.                     -c ("puttyCtx -e -mtm " + " \"push\" `currentCtx`");
  515.                 menuItem -rp "W" -l "Smooth"
  516.                     -c ("puttyCtx -e -mtm " + " \"smooth\" `currentCtx`");
  517.                 menuItem -rp "E" -l "Erase"
  518.                     -c ("puttyCtx -e -mtm " + " \"erase\" `currentCtx`");
  519.                 jasperBrushReflectMode( $jasperCmd ) ;
  520.             setParent -m ..;
  521.         }
  522.         else if ( $jasperCmd == "selectPaintCtx" ) {
  523.                popupMenu -mm 1 -b 1 -p viewPanes tempMM;
  524.                    menuItem -rp "N" -l "Toggle"
  525.                     -c ("selectPaintCtx -e -st " + " \"toggle\" `currentCtx`");
  526.                    menuItem -rp "W" -l "Select"
  527.                        -c ("selectPaintCtx -e -st " + " \"select\" `currentCtx`");
  528.                    menuItem -rp "E" -l "UnSelect"
  529.                        -c ("selectPaintCtx -e -st " + " \"unselect\" `currentCtx`");
  530.                 jasperBrushReflectMode( $jasperCmd ) ;
  531.             setParent -m ..;
  532.         }
  533.         else if ( $jasperCmd == "setEditPaintCtx" ) {
  534.               popupMenu -mm 1 -b 1 -p viewPanes tempMM;
  535.                 menuItem -rp "N" -l "Transfer"
  536.                     -c ("setEditPaintCtx -e -sot " + " \"transfer\" `currentCtx`");
  537.                 menuItem -rp "W" -l "Add"
  538.                     -c ("setEditPaintCtx -e -sot " + " \"add\" `currentCtx`");
  539.                 menuItem -rp "E" -l "Remove"
  540.                     -c ("setEditPaintCtx -e -sot " + " \"remove\" `currentCtx`");
  541.                setParent -m ..;
  542.         }
  543.         else if ( $jasperCmd == "attrPaintCtx" ) {
  544.             jasperAttrPaintBrushMode( $jasperCmd );
  545.         }            
  546.         else { // ($jasperCmd == "userPaintCtx" or $jasperCmd == "wtPaintCtx")
  547.                popupMenu -mm 1 -b 1 -p viewPanes tempMM;
  548.                    menuItem -rp "N" -l "Add"
  549.                        -c ($jasperCmd + " -e -et \"additive\" `currentCtx`");
  550.                    menuItem -rp "S" -l "Scale"
  551.                        -c ($jasperCmd + " -e -et \"scale\" `currentCtx`");
  552.                    menuItem -rp "W" -l "Smooth"
  553.                        -c ($jasperCmd + " -e -et \"smooth\" `currentCtx`");
  554.                    menuItem -rp "E" -l "Replace"
  555.                        -c ($jasperCmd + " -e -et \"absolute\" `currentCtx`");
  556.                 jasperBrushReflectMode( $jasperCmd ) ;
  557.                setParent -m ..;
  558.         }
  559.     }
  560. }
  561.  
  562.  
  563. global proc puttyIncreaseMaxDisp( )
  564. {
  565.     if ( isPuttyCtx() ) {
  566.         // we have to make sure that we are not increasing 
  567.         // the maximum displacement beyond the upper limit
  568.         float $maxDisp = eval( "puttyCtx -q -maxdisp `currentCtx`" );
  569.         $maxDisp = 1.1 * $maxDisp;
  570.         if ( $maxDisp > 5.0 ) { $maxDisp = 5.0; }
  571.         $cmd = "puttyCtx -e -maxdisp " + $maxDisp + " `currentCtx`";
  572.         eval( $cmd );
  573.     }
  574. }
  575.  
  576. global proc puttyDecreaseMaxDisp( )
  577. {
  578.     if ( isPuttyCtx() ) {
  579.         // we have to make sure that we are not decreasing 
  580.         // the maximum displacement beyond the lower limit
  581.         float $maxDisp = eval( "puttyCtx -q -maxdisp `currentCtx`" );
  582.         $maxDisp = 0.9 * $maxDisp;
  583.         if ( $maxDisp < 0.0 ) { $maxDisp = 0.0; }
  584.         $cmd = "puttyCtx -e -maxdisp " + $maxDisp + " `currentCtx`";
  585.         eval( $cmd );
  586.     }
  587. }
  588.  
  589.  
  590. global proc puttyFloodStitch( ) 
  591. {
  592.     if ( isPuttyCtx() ) {
  593.         puttyCtx -e -stitchedgeflood `currentCtx`;
  594.     }
  595. }
  596.  
  597.  
  598. global proc puttyUpdateEraseSurface( ) 
  599. {
  600.     if ( isPuttyCtx() ) {
  601.         puttyCtx -e -updateerasesrf `currentCtx`;
  602.     }
  603. }
  604.  
  605.  
  606. global proc puttyUpdateReferenceSurface( ) 
  607. {
  608.     if ( isPuttyCtx() ) {
  609.         puttyCtx -e -updaterefsrf `currentCtx`;
  610.     }
  611. }
  612.  
  613.  
  614. global proc puttyToggleAutosmooth()
  615. {
  616.     if ( isPuttyCtx() ) {
  617.         string $cmd = "puttyCtx -q -autosmooth `currentCtx`";
  618.         if ( eval($cmd) ) {
  619.             puttyCtx -e -autosmooth false `currentCtx`;
  620.         } else {
  621.             puttyCtx -e -autosmooth true `currentCtx`;
  622.         }
  623.     }
  624. }
  625.  
  626.  
  627. global proc wtPaintToggleColorFeedback( ) 
  628. {
  629.     string     $jasperCmd = jasperCommand();
  630.  
  631.     if ( isValuePaintCtx() ) {
  632.  
  633.         string $cmd = "valuePaintCtx -q -colorfeedback `currentCtx`";
  634.  
  635.         if ( eval($cmd) ) {
  636.             eval( "valuePaintCtx  -e -colorfeedback false `currentCtx`" );
  637.         }
  638.         else {
  639.             eval( "valuePaintCtx  -e -colorfeedback true `currentCtx`" );
  640.         }
  641.     }
  642. }
  643.  
  644. global proc activateSelectCluster()
  645. {
  646.     if ( isWtPaintCtx() ) {
  647.         wtPaintCtx -e -selectclustermode true `currentCtx`;
  648.     }
  649. }
  650.  
  651.  
  652. global proc deactivateSelectCluster()
  653. {
  654.     if ( isWtPaintCtx() ) {
  655.         wtPaintCtx -e -selectclustermode false `currentCtx`;
  656.     }
  657. }
  658.  
  659. global proc activatePickColorMode()
  660. {
  661.     commonPaintCtx -e -brushoperate "pickcolor" `currentCtx`;
  662. }
  663.  
  664. global proc deactivatePickColorMode()
  665. {
  666.     commonPaintCtx -e -brushoperate "paint" `currentCtx`;
  667. }
  668.  
  669. proc dynPaintResize(string $sliderName)
  670. {
  671.     if (isDynWireContext()) {
  672.         dynWireCtx -e -dbs $sliderName `currentCtx`;
  673.     }
  674.     if (isAdynPaintPanel()) {
  675.         global string $gDynPaintEditorName;
  676.         dynPaintCtx -e -dbs $sliderName `dynPaintEditor -q -drc $gDynPaintEditorName`;
  677.     }    
  678. }
  679.  
  680. // global procs for activating/deactivating screen sliders
  681. //
  682. global proc activateScreenSlider(
  683.     string $sliderName
  684. )
  685. {
  686.     if ( isCommonPaintCtx() ) {
  687.         commonPaintCtx -e -slider $sliderName `currentCtx`;
  688.     }
  689.     if (`isTrue "MayaCreatorExists"` && (`licenseCheck -m "edit" -typ "particlePaint"`)) {
  690.         if( $sliderName == "displacement" ) {
  691.             dynPaintResize("offset");
  692.         }else if( $sliderName == "lower_radius" ) {
  693.             dynPaintResize("width");
  694.         }else {
  695.             dynPaintResize("size");
  696.         }
  697.     }
  698. }
  699.  
  700. global proc activateReflectIsoparmScreenSlider()
  701. {
  702.     string $ctx = `currentCtx`;
  703.  
  704.     if ( isCommonPaintCtx()
  705.       && eval("commonPaintCtx -q -reflectpaint " +  $ctx) ) {
  706.         string $reflectType = `commonPaintCtx -q -reflectpainttype $ctx`;
  707.  
  708.         if ( $reflectType == "reflectU" ) {
  709.             commonPaintCtx -e -slider "u_reflect_isoparm" $ctx;
  710.         } else if ( $reflectType == "reflectV" ) {
  711.             commonPaintCtx -e -slider "v_reflect_isoparm" $ctx;
  712.         }
  713.     }
  714. }
  715.  
  716. global proc deactivateScreenSlider()
  717. {
  718.     if ( isCommonPaintCtx() ) {
  719.         commonPaintCtx -e -slider "none" `currentCtx`;
  720.     }
  721.     if (`isTrue "MayaCreatorExists"` ) {
  722.         dynPaintResize("none");
  723.     }
  724. }
  725.  
  726. global string    $globalScreenSliderMode = "none";
  727.  
  728. global proc setGlobalScreenSliderMode()
  729. {
  730.     if ( isCommonPaintCtx() ) {
  731.         deletePopupMenu();
  732.         
  733.         popupMenu -mm 1 -b 1 -p viewPanes tempMM;
  734.             menuItem -rp "N" -l "Upper Radius"
  735.                 -c "$globalScreenSliderMode = \"upper_radius\"";
  736.             menuItem -rp "S" -l "Reflect Isoparm"
  737.                 -c "$globalScreenSliderMode = \"reflect_isoparm\"";
  738.             if ( isSurfacePaintCtx() ) {
  739.                 menuItem -rp "W" -l "Opacity"
  740.                     -c "$globalScreenSliderMode = \"opacity\"";
  741.                 if ( isPuttyCtx() ) {
  742.                     menuItem -rp "E" -l "Displacement"
  743.                         -c "$globalScreenSliderMode = \"displacement\"";
  744.                 } else if ( isValuePaintCtx() ) {
  745.                     menuItem -rp "E" -l "Value"
  746.                         -c "$globalScreenSliderMode = \"value\"";
  747.                 }
  748.             }
  749.         setParent -m ..;
  750.     }
  751. }
  752.  
  753. global proc activateGlobalScreenSlider()
  754. {
  755.     global string    $globalScreenSliderMode;
  756.  
  757.     if ( $globalScreenSliderMode == "reflect_isoparm" ) {
  758.         activateReflectIsoparmScreenSlider();
  759.         if (`isTrue "MayaCreatorExists"` ) {
  760.             dynPaintResize("size");
  761.         }
  762.     } else {
  763.         activateScreenSlider( $globalScreenSliderMode );
  764.     } 
  765. }
  766.  
  767. global proc jasperNamedCommandSetup( )
  768. {
  769.     assignCommand -e -addDivider "Maya Artisan Tools";
  770.  
  771.  
  772.     // =======================================================
  773.     // Global commands - general across all the Artisan tools
  774.     //
  775.     // Reflection
  776.     nameCommand -annotation "Toggle Reflection ON/OFF"
  777.         -command ("ToggleReflection")
  778.         ToggleReflection_in_Jasper;
  779.     
  780.     // Show Preview on/off
  781.     nameCommand -annotation "Toggle Show Preview ON/OFF"
  782.         -command ("TogglePreview")
  783.         TogglePreview_in_Jasper;
  784.  
  785.     // Masking on/off
  786.     nameCommand -annotation "Toggle Masking CVs ON/OFF"
  787.         -command ("ToggleMaskingCVs")
  788.         ToggleMaskingCVs_in_Jasper;
  789.  
  790.     // Toggle common edge display
  791.     nameCommand -annotation "Toggle Common Edges Display Mode"
  792.         -command ("ToggleCommonEdgesDisplay")
  793.         ChangeCommEdgeDisplay_in_Jasper;
  794.  
  795.     // Toggle common corner display
  796.     nameCommand -annotation "Toggle Common Corners Display"
  797.         -command ("ToggleCommonCornersDisplay")
  798.         ToggleCommCornerDisplay_in_Jasper;
  799.  
  800.  
  801.     // =======================================================
  802.     // Scuplt tool (puttyContext) name commands
  803.     // 
  804.     // Flood Stitch
  805.     nameCommand -annotation "Stitch Surfaces"
  806.         -command ("FloodStitch")
  807.         FloodStitch_in_Jasper;
  808.  
  809.     // Update Erase Surface
  810.     nameCommand -annotation "Update Erase Surface"
  811.         -command ("UpdateEraseSurface") 
  812.         UpdateEraseSurface_in_Jasper;
  813.  
  814.     // Update Reference Surface
  815.     nameCommand -annotation "Update Reference Surface"
  816.         -command ("UpdateReferenceSurface")
  817.         UpdateReferenceSurface_in_Jasper;
  818.  
  819.     // Toggle Autosmooth
  820.     nameCommand -annotation "Toggle Autosmooth"
  821.         -command ("ToggleAutoSmooth")
  822.         ToggleAutosmooth_in_Jasper;
  823.  
  824.  
  825.     // =======================================================
  826.     // Value tools commands 
  827.     //
  828.     // Turn color feedback on/off
  829.     nameCommand -annotation "Toggle Color Feedback ON/OFF"
  830.         -command ("ToggleColorFeedback")
  831.         ColorFeedback_in_Jasper;
  832.  
  833.     // Select cluster mode
  834.     nameCommand -annotation "Activate Select Cluster Mode (Press)" 
  835.         -command ("SelectClusterActivate")
  836.         SelectCluster_in_Jasper;
  837.  
  838.     nameCommand -annotation "Deactivate Select Cluster Mode (Release)" 
  839.         -command ("SelectClusterDectivate")
  840.         SelectCluster_in_Jasper_release;
  841.  
  842.     // named commands for activating/deactivating screen sliders
  843.     //
  844.     nameCommand -annotation "Activate   Modify Lower Brush Radius (Press) / Modify Paint Effects Brush Size" 
  845.         -command ("ModifyLowerRadiusPress")
  846.         ModifyLowerRadius_in_Jasper;
  847.  
  848.     nameCommand -annotation "Deactivate Modify Lower Brush Radius (Release)" 
  849.         -command ("ModifyLowerRadiusRelease")
  850.         ModifyLowerRadius_in_Jasper_release;
  851.  
  852.     nameCommand -annotation "Activate   Modify Upper Brush Radius (Press) / Modify Paint Effect Brush Scale" 
  853.         -command ("ModifyUpperRadiusPress")
  854.         ModifyUpperRadius_in_Jasper;
  855.  
  856.     nameCommand -annotation "Deactivate Modify Upper Brush Radius (Release)" 
  857.         -command ("ModifyUpperRadiusRelease")
  858.         ModifyUpperRadius_in_Jasper_release;
  859.  
  860.     nameCommand -annotation "Activate   Modify Max Displacement (Press) / Modify Paint Effect Surface Offset" 
  861.         -command ("ModifyDisplacementPress")
  862.         ModifyDisplacement_in_Jasper;
  863.  
  864.     nameCommand -annotation "Deactivate Modify Max Displacement (Release)" 
  865.         -command ("ModifyDisplacementRelease")
  866.         ModifyDisplacement_in_Jasper_release;
  867.  
  868.     nameCommand -annotation "Activate   Modify Opacity (Press)" 
  869.         -command ("ModifyOpacityPress")
  870.         ModifyOpacity_in_Jasper;
  871.  
  872.     nameCommand -annotation "Deactivate Modify Opacity (Release)" 
  873.         -command ("ModifyOpacityRelease")
  874.         ModifyOpacity_in_Jasper_release;
  875.  
  876.     nameCommand -annotation "Activate   Modify Value (Press)" 
  877.         -command ("ModifyValuePress")
  878.         ModifyValue_in_Jasper;
  879.  
  880.     nameCommand -annotation "Deactivate Modify Value (Release)"
  881.         -command ("ModifyValueRelease")
  882.         ModifyValue_in_Jasper_release;
  883.  
  884.     nameCommand -annotation "Activate   Modify Reflection Isoparm (Press)"
  885.         -command ("ModifyReflectionIsoparmPress")
  886.         ModifyReflIsoparm_in_Jasper;
  887.  
  888.     nameCommand -annotation "Deactivate Modify Reflection Isoparm (Release)" 
  889.         -command ("ModifyReflectionIsoparmRelease")
  890.         ModifyReflIsoparm_in_Jasper_release;
  891.  
  892.     nameCommand -annotation "Activate   Modify Target (Press)" 
  893.         -command ("ModifiyTargetPress")
  894.         GlobalScreenSlider_in_Jasper;
  895.  
  896.     nameCommand -annotation "Deactivate Modify Target (Release)" 
  897.         -command ("ModifiyTargetRelease")
  898.         GlobalScreenSlider_in_Jasper_release;
  899.  
  900.     nameCommand -annotation "Set Modify Target, with Marking Menu (Press)" 
  901.         -command ("ModifyTargetMarkingMenu")
  902.         setGlobalScreenSliderMode_in_Jasper;
  903.  
  904.     nameCommand -annotation "Set Modify Target, with Marking Menu (Release)" 
  905.         -command ("ModifyTargetMarkingMenuPopDown")
  906.         setGlobalScreenSliderMode_in_Jasper_revert;
  907.  
  908.     nameCommand -annotation "Activate   Modify Sculpt Reference Vector (Press)"
  909.         -command ("ModifySculptReferenceVectorMarkingMenu")
  910.         setPuttyReferenceVector_in_Jasper;
  911.  
  912.     nameCommand -annotation "Deactivate Modify Sculpt Reference Vector (Release)"
  913.         -command ("ModifySculptReferenceVectorMarkingMenuPopDown")
  914.         setPuttyReferenceVector_in_Jasper_release;
  915. }
  916.  
  917.  
  918. // ---------------------------------------------------------------
  919. //     obsolete functions - keeping them for backwards compatibility
  920. // ---------------------------------------------------------------
  921.  
  922. global proc puttyBrushMode( )
  923. {
  924.     string $currentContext = `currentCtx`;
  925.     string $currentTool    = `contextInfo -c $currentContext`;
  926.  
  927.     if ( $currentTool == "putty" ) {
  928.         deletePopupMenu();
  929.  
  930.         popupMenu -mm 1 -b 1 -p viewPanes tempMM;
  931.             menuItem -rp "N" -l "Pull"
  932.                 -c ("puttyCtx -e -mtm " + " \"pull\" `currentCtx`");
  933.             menuItem -rp "S" -l "Push"
  934.                 -c ("puttyCtx -e -mtm " + " \"push\" `currentCtx`");
  935.             menuItem -rp "W" -l "Smooth"
  936.                 -c ("puttyCtx -e -mtm " + " \"smooth\" `currentCtx`");
  937.             menuItem -rp "E" -l "Erase"
  938.                 -c ("puttyCtx -e -mtm " + " \"erase\" `currentCtx`");
  939.         setParent -m ..;
  940.     }
  941. }
  942.  
  943. global proc selectBrushMode( )
  944. {
  945.     string $currentContext = `currentCtx`;
  946.     string $currentTool    = `contextInfo -c $currentContext`;
  947.  
  948.     if ( $currentTool == "selectPaint" ) {
  949.         deletePopupMenu();
  950.  
  951.         popupMenu -mm 1 -b 1 -p viewPanes tempMM;
  952.             menuItem -rp "N" -l "Toggle"
  953.                 -c ("selectPaintCtx -e -st " + " \"toggle\" `currentCtx`");
  954.             menuItem -rp "W" -l "Select"
  955.                 -c ("selectPaintCtx -e -st " + " \"select\" `currentCtx`");
  956.             menuItem -rp "E" -l "UnSelect"
  957.                 -c ("selectPaintCtx -e -st " + " \"unselect\" `currentCtx`");
  958.         setParent -m ..;
  959.     }
  960. }
  961.  
  962. global proc userPaintBrushMode( )
  963. {
  964.     string $currentContext = `currentCtx`;
  965.     string $currentTool    = `contextInfo -c $currentContext`;
  966.  
  967.     if ( $currentTool == "userPaint" ) {
  968.         deletePopupMenu();
  969.  
  970.         popupMenu -mm 1 -b 1 -p viewPanes tempMM;
  971.             menuItem -rp "E" -l "Replace"
  972.                  -c  ("userPaintCtx -e -et " + " \"absolute\" `currentCtx`");
  973.             menuItem -rp "N" -l "Add"
  974.                  -c  ("userPaintCtx -e -et " + " \"additive\" `currentCtx`");
  975.             menuItem -rp "S" -l "Scale"
  976.                  -c  ("userPaintCtx -e -et " + " \"scale\" `currentCtx`");
  977.             menuItem -rp "W" -l "Smooth"
  978.                  -c  ("userPaintCtx -e -et " + " \"smooth\" `currentCtx`");
  979.         setParent -m ..;
  980.     }
  981. }
  982.  
  983. global proc attrPaintBrushMode( )
  984. {
  985.     string $currentContext = `currentCtx`;
  986.     string $currentTool    = `contextInfo -c $currentContext`;
  987.  
  988.     if ( $currentTool == "attrPaint" || attrPaintInstCheckTool($currentTool) ) {
  989.         deletePopupMenu();
  990.  
  991.         popupMenu -mm 1 -b 1 -p viewPanes tempMM;
  992.             menuItem -rp "E" -l "Replace"
  993.                  -c  ("attrPaintCtx -e -et " + " \"absolute\" `currentCtx`");
  994.             menuItem -rp "N" -l "Add"
  995.                  -c  ("attrPaintCtx -e -et " + " \"additive\" `currentCtx`");
  996.             menuItem -rp "S" -l "Scale"
  997.                  -c  ("attrPaintCtx -e -et " + " \"scale\" `currentCtx`");
  998.             menuItem -rp "W" -l "Smooth"
  999.                  -c  ("attrPaintCtx -e -et " + " \"smooth\" `currentCtx`");
  1000.         setParent -m ..;
  1001.     }
  1002. }
  1003.  
  1004. global proc weightPaintBrushMode( )
  1005. {
  1006.     string $currentContext = `currentCtx`;
  1007.     string $currentTool    = `contextInfo -c $currentContext`;
  1008.  
  1009.     if ( $currentTool == "wtPaint" ) {
  1010.         deletePopupMenu();
  1011.  
  1012.         popupMenu -mm 1 -b 1 -p viewPanes tempMM;
  1013.             menuItem -rp "E" -l "Replace"
  1014.                 -c ("wtPaintCtx -e -et " + " \"absolute\" `currentCtx`");
  1015.             menuItem -rp "N" -l "Add"
  1016.                 -c ("wtPaintCtx -e -et " + " \"additive\" `currentCtx`");
  1017.             menuItem -rp "S" -l "Scale"
  1018.                 -c ("wtPaintCtx -e -et " + " \"scale\" `currentCtx`");
  1019.             menuItem -rp "W" -l "Smooth"
  1020.                 -c ("wtPaintCtx -e -et " + " \"smooth\" `currentCtx`");
  1021.         setParent -m ..;
  1022.     }
  1023. }
  1024.